<?php
include_once '../data/database_dal.php';

class CategoryDAL extends DatabaseDAL
{
    function update($id, $category, $parentID, $inTime, $inUser)
    {
        $this->connect();
        $result = $this->mysqli->query("call pr_category_update('". $id ."', '". $category ."', '". $parentID ."', '". $inTime ."', '". $inUser ."')");
        $this->close();
        return $result;
    }

    function get($where)
    {
        $this->connect();
        return $this->mysqli->query("call pr_category_get(".'"'.$where.'"'.")");
        $this->close();
        return $result;
    }

    function getAll($orderBy)
    {
        $this->connect();
        $result = $this->mysqli->query("call pr_category_list(".'"'.$orderBy.'"'.")");
        return $result;
        $this->close();

    }

    function delete($id)
    {
        $this->connect();
        $result = $this->mysqli->query("call pr_category_delete('". $id ."')");
        $this->close();
        return $result;
    }

    function validate($id, $category)
    {
        $this->connect();
        $result = $this->mysqli->query("call pr_category_validate('". $id ."', '". $category ."')");
        $this->close();
        return $result;
    }
}
?>